#include <bits/stdc++.h> 
#define meow(args...) fprintf(stderr, args)
typedef unsigned long long u64;
const int B=90, P=1e9+7;
int n, sum, val[B], dup[B], f[B][B][B], g[B][B][B], binom[B][B], fall[B][B];
void trans(int dup) {
	sum+=dup;
	for(int a=0; a<=dup; ++a) {
		for(int b=0; b<=sum; ++b) {
			memcpy(g[a][b], f[a][b], (sum/2+1)*sizeof(int));
			memset(f[a][b], 0, (sum/2+1)*sizeof(int));
		}
	}
	for(int a=0; a<=dup; ++a) {
		for(int b=0; b<=sum; ++b) {
			for(int c=0; b+2*c<=sum; ++c) {
				if(g[a][b][c])
					f[dup-a][b+a][c]=1llu*fall[dup][a]*g[a][b][c]%P;
			}
		}
	}
	for(int a=0; a<=dup; ++a) {
		for(int b=0; b<=sum; ++b) {
			for(int c=0; b+2*c<=sum; ++c) {
				if(f[a][b][c]==0) continue;
				for(int d=1; d<=a; ++d)
					f[a-d][b+d][c]=(f[a-d][b+d][c]+1llu*binom[a][d]*f[a][b][c])%P;
			}
		}
	}
	for(int a=0; a<=dup; ++a) {
		for(int b=0; b<=sum; ++b) {
			for(int c=0; b+2*c<=sum; ++c) {
				if(f[a][b][c]==0) continue;
				for(int d=1; 2*d<=a; ++d)
					f[a-2*d][b][c+d]=(f[a-2*d][b][c+d]+1llu*binom[a][2*d]*fall[2*d][d]%P*f[a][b][c])%P;
			}
		}
	}
}
int main() {
    freopen("palindrome.in","r",stdin);
    freopen("palindrome.out","w",stdout);
	scanf("%d", &n);
	for(int i=1; i<=n; ++i) {
		int x;
		scanf("%d", &x);
		++val[x];
	}
	std::sort(val, val+81, std::greater<int>());
	int cnt=0;
	for(int l=0, r=0; val[l]; l=r) {
		while(val[l]==val[r]) ++r;
		val[cnt]=val[l];
		dup[cnt++]=r-l;
	}
	int maxtot=0;
	for(int i=0; i<cnt; ++i) maxtot+=val[i]*(val[i]+1)/2*dup[i];
	for(int i=0; i<B; ++i) {
		binom[i][0]=binom[i][i]=1;
		for(int j=1; j<i; ++j)
			binom[i][j]=(0u+binom[i-1][j-1]+binom[i-1][j])%P;
	}
	for(int i=0; i<B; ++i) {
		fall[i][0]=1;
		for(int j=1; j<=i; ++j)
			fall[i][j]=(i-j+1llu)*fall[i][j-1]%P;
	}
	int dup1=0, dup2=0;
	for(int i=0; i<cnt; ++i) {
		if(val[i]==1) dup1=dup[i];
		if(val[i]==2) dup2=dup[i];
	}
	f[0][0][0]=1;
	for(int i=0; i<cnt && val[i]>2; ++i) {
		trans(dup[i]);
		for(int a = i+1==cnt || val[i]!=val[i+1]+1 ? 1 : dup[i+1]+1; a<=dup[i]; ++a) {
			for(int b=0; b<=sum; ++b)
				memset(f[a][b], 0, (sum/2+1)*sizeof(int));
		}
	}
	trans(dup2);
	int ans=0;
	for(int a=0; a<=dup2; ++a) {
		for(int b=0; b<=sum; ++b) {
			for(int c=0; b+2*c<=sum; ++c) {
				if(f[a][b][c])
					ans=(ans+1llu*(a?fall[a+b+dup1-1][a]:1)*fall[b+c+dup1][b+c+dup1]%P*f[a][b][c])%P;
			}
		}
	}
	printf("%d %d\n", maxtot, ans);
	return 0;
}

